<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>以 PNG 格式将图像输出到浏览器或文件</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.imagepalettetotruecolor.html">imagepalettetotruecolor</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.imagepolygon.html">imagepolygon</a></div>
 <div class="up"><a href="ref.image.html">GD and Image 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.imagepng" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">imagepng</h1>
  <p class="verinfo">(PHP 4, PHP 5)</p><p class="refpurpose"><span class="refname">imagepng</span> &mdash; <span class="dc-title">以 PNG 格式将图像输出到浏览器或文件</span></p>

 </div>
 <div class="refsect1 unknown-seealsp" id="refsect1-function.imagepng-unknown-seealsp">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">bool</span> <span class="methodname"><strong>imagepng</strong></span>
    ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$image</code></span>
   [, <span class="methodparam"><span class="type">string</span> <code class="parameter">$filename</code></span>
  ] )</div>

  <p class="para rdfs-comment">
   <span class="function"><strong>imagepng()</strong></span> 将 GD 图像流（<em><code class="parameter">image</code></em>）以
   PNG 格式输出到标准输出（通常为浏览器），或者如果用
   <em><code class="parameter">filename</code></em> 给出了文件名则将其输出到该文件。
   <div class="informalexample">
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$im&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">imagecreatefrompng</span><span style="color: #007700">(</span><span style="color: #DD0000">"test.png"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">imagepng</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div>
  </p>
  <p class="para">
   参见 <span class="function"><a href="function.imagegif.html" class="function">imagegif()</a></span>，<span class="function"><a href="function.imagewbmp.html" class="function">imagewbmp()</a></span>，<span class="function"><a href="function.imagejpeg.html" class="function">imagejpeg()</a></span>
   和 <span class="function"><a href="function.imagetypes.html" class="function">imagetypes()</a></span>。
  </p>
 </div>

</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.imagepalettetotruecolor.html">imagepalettetotruecolor</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.imagepolygon.html">imagepolygon</a></div>
 <div class="up"><a href="ref.image.html">GD and Image 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
